package com.javaEE.tes.dao;

import com.javaEE.tes.dao.dto.CharData;
import com.javaEE.tes.entities.Student;
import com.javaEE.tes.entities.Teacher;
import com.javaEE.tes.entities.UserAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface TeacherRepository extends CrudRepository<Teacher,Long> {
    @Autowired
    List<Teacher> findAll();
    @Query(nativeQuery = true,value = "SELECT education AS label, COUNT(*) AS value FROM teacher GROUP BY education")
    List<CharData> getTeacherEducation();
   Teacher findByUserAccount_UserId(Long userId);
    @Query(nativeQuery = true,value = "SELECT t.teacher_num as teacherNum FROM teacher AS t WHERE t.teacher_num = ? ")
   String findByTeacherNum(String teacherNum);

}
